interface DataChild {
	[key: string]: any;
	parentId: number | null;
	id: number;
}

export function addChildrenToData(data: DataChild, datas: Array<DataChild>) {
	const children = datas.filter((p) => p?.parentId === data?.id);
	if (children.length > 0) {
		data.children = children.map((child) => addChildrenToData(child, datas));
	}
	return data;
}
